<?php

namespace app\api\controller;

use app\common\controller\Api;
use app\api\service\wanlshop\Activity as ActivityService;


/**
 * 活动接口
 */
class Activity extends Api
{
    protected $noNeedRight = '*';
    // 活动服务
    protected $activityService = null;

    public function _initialize()
    {
        parent::_initialize();

        $this->activityService = new ActivityService();
    }


    /**
     *  活动列表
     */

    public function activityList()
    {
        try {
            $this->request->filter(['strip_tags']);
            $response = $this->activityService->activityListService();
        } catch (\Exception $e) {
            $this->errorRewrite($e->getMessage());
        }
        $this->success('成功', $response, 1);
    }

    /**
     *  活动商品列表
     */

    public function activityGoodsList()
    {
        try {
            $this->request->filter(['strip_tags']);
            $params = $this->request->get();
            $params['pageSize'] = isset($params['pageSize']) && !empty($params['pageSize']) ? $params['pageSize'] : 10;
            $params['page'] = isset($params['page']) && !empty($params['page']) ? $params['page'] : 1;
            $response = $this->activityService->activityGoodsListService($params);
        } catch (\Exception $e) {
            $this->errorRewrite($e->getMessage());
        }
        $this->success('成功', $response, 1);
    }

}
